package net.openvision.util.logical;

public abstract class Predicate implements LogicalExpression {

	public abstract int getArity();

	public abstract boolean evaluate(Object... args);

	public boolean evaluate(Environment e) {
		Object[] vals = e.getValues();
		if (vals.length != getArity())
			throw new IllegalArgumentException(
					"Number of arguments does not match arity of this predicate.");
		return evaluate(vals);
	}
}
